
#ifndef __MUSIC_ENGINE_OGG_H_
#define __MUSIC_ENGINE_OGG_H_



#define OGG_ENGINE_PLAY_TASK_STACKSIZE 0x2000
#define OGG_ENGINE_PLAY_TASK_QUANTUM 10
#define OGG_ENGINE_MBF_SIZE 1024


struct ogg_engine_parameter
{
	OSAL_ID	ogg_engine_message_buffer_id;
	OSAL_ID ogg_engine_flag_id;
	OSAL_ID ogg_engine_task_id;
};



typedef struct
{
	OggVorbis_File vf;
	FILE *file;
	BOOL stop_imm;
	unsigned long start_position, length;
	int command, seek_to;
	double song_time;
	int channel, samplerate;
	int last_frm_dura;
	unsigned int pcm_out_buff;
	unsigned int processed_pcm_buff;
}OggFile;



typedef enum _OggEngineMessageType {
	OGG_CMD_NONE=0,
	OGG_CMD_START,
	OGG_CMD_PAUSE,
	OGG_CMD_RESUME,
	OGG_CMD_WAIT_FOR_STOP,
	OGG_CMD_STOP,
}OggEngineMessageType;









typedef enum _OggEngineFlag {
	OGG_ENGINE_FLAG_INITIALIZE				= 0x00000000,
	OGG_ENGINE_FLAG_SUCCESS					= 0x00000001,
	OGG_ENGINE_FLAG_UNSUCCESSFUL			= 0x00000002,
	OGG_ENGINE_FLAG_TASK_EXIT				= 0x00000004,
	OGG_ENGINE_FLAG_MASK					= 0x00000007,
}OggEngineFlag;


static int ogg_init(struct pe_music_cfg *pe_music_cfg);

static void ogg_cleanup(void);

static int ogg_is_our_file(char *filename);

static void ogg_play_task();

static int ogg_play_file(char *filename, mp_callback_func cb);

static void ogg_stop(void);

static void ogg_pause(BOOL pause);

static void ogg_seek(int time);

static int ogg_get_time(void);

static int ogg_get_song_info(char *filename, MusicInfo *music_info);

static int ogg_get_decoder_info(char *filename, DecoderInfo *decoder_info);

#endif
